<script lang="ts">
export default {
  name: 'App'
}
</script>

<template>
  <main>
    <p ref="pName">李四</p>
    <button @click="clickP" >获取主p标签</button>
    <Hello ref="h1" />
    <button @click="clickP1" >获取Hello标签</button>
  </main>
</template>

<script setup lang="ts">
import Hello from './components/hello.vue'
import { ref } from 'vue'

let pName = ref()
let h1 = ref()

function clickP() { 
  console.log(pName.value);
}
//获取子组件的标签
function clickP1() { 
  console.log(h1.value.pName);
}
  
</script>
